<?php
    Class History_revenue_model extends CI_Model
    {
        public function __construct()
        {
          parent::__construct();
        }       

       public function index()
       {

       }

       public function getHistory($fromDate, $toDate, $user_id)
       {
          $this->db->select('*');
          $this->db->from('history_revenue');
          $this->db->where('date_created >', $fromDate);
          $this->db->where('date_created <', $toDate);
          $this->db->where('user_id', $user_id);

          $query = $this->db->get();

          return $query->result();
       }

       public function getHistory1($fromDate, $toDate, $user_id)
       {
          $select_date = date('Y-m-d',strtotime('now'));

          $this->db->select('*');
          $this->db->from('history_revenue');
          $this->db->where('date_created >', $fromDate);
          $this->db->where('date_created <', $toDate);       
          $this->db->where('user_id', $user_id);
          $this->db->limit(1);

          $query = $this->db->get();

          return $query->row();
       }

       public function insert($data)
       {
          return $this->db->insert('history_revenue', $data);
       }

       public function update($data, $id)
       {
          $this->db->where('id', $id);
          return $this->db->update('history_revenue',$data);
       }
    }
?>
